#include "NFileComponent.h"

using namespace Game;

RTTI_DEFINITIONS(NFileComponent)

NFileComponent::NFileComponent(void)
	: NComponent(),
	 mType(FileType_Invalid),
	 mFilePath("")
{
}

NFileComponent::~NFileComponent(void)
{
}

void NFileComponent::Initialize(Engine::NEntity*)
{

}

void NFileComponent::Deinitialize()
{

}

void NFileComponent::Update(float)
{

}

void NFileComponent::SetFile(const char* file)
{
	mFilePath = file;
}

std::string NFileComponent::GetFile() const
{
	return mFilePath;
}

void NFileComponent::SetType(std::string type)
{
	if(type == "Sprite")
	{
		mType = FileType_Sprite;
	}
	else if(type == "Texture")
	{
		mType = FileType_Texture;
	}
	else if(type == "Mesh")
	{
		mType = FileType_Mesh;
	}
	else if(type == "Material")
	{
		mType = FileType_Material;
	}
	else
	{
		mType = FileType_Invalid;
	}
}

void NFileComponent::SetType(FileType type)
{
	mType = type;
}

void NFileComponent::SetData(std::pair<std::string, std::string> data)
{
	if(data.first == "type")
	{
		SetType(data.second);
	}
	else if(data.first == "file")
	{
		SetFile(data.second.c_str());
	}
}